package com.gxa.service.impl;

import com.gxa.common.R;
import com.gxa.common.vo.AttendancePageRequest;
import com.gxa.common.vo.CountStatusVo;
import com.gxa.mapper.CustomerManagementMapper;
import com.gxa.mapper.SysDiagnosisMapper;
import com.gxa.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 *商业报表
 */
@Service
public class BusinessReportImpl implements BusinessService {

    @Autowired
    SysDiagnosisMapper diagnosisMapper;

    @Autowired
    CustomerManagementMapper customerManagementMapper;

    /**
     * 诊断统计，客服统计
     * @param attendancePageRequest
     * @return
     */
    @Override
    public R showBusinessReport(AttendancePageRequest attendancePageRequest) {

        Map<String,CountStatusVo> map = new HashMap<>();
        CountStatusVo diagnosisRes = diagnosisMapper.countDiagnosisByStatus(attendancePageRequest);
        CountStatusVo customerRes = customerManagementMapper.countDiagnosisByStatus(attendancePageRequest);

        map.put("diagnosisRes",diagnosisRes);
        map.put("customerRes",customerRes);

        R r = new R();
        r.setCode(200);
        r.setMsg("成功");
        r.setData(map);
        return r;
    }
}
